﻿using HeinQi.Framework.LayerBases;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TbShop.Data.Components
{
    public interface IDataComponentsBase<TEntityBase> where TEntityBase : EntityBase
    {
        TEntityBase Get(int id);

        TEntityBase Remove(TEntityBase item);

        TEntityBase Remove(int id, int versionNumber);

        void RemoveAll(IEnumerable<TEntityBase> items);

        void RemoveAll(IEnumerable<int> items);

        bool Delete(int id);

        TEntityBase Update(TEntityBase item);

        TEntityBase Add(TEntityBase item);

        TEntityBase Save(TEntityBase item);

        IQueryable<TEntityBase> GetAll();

        IQueryable<TEntityBase> GetAllWithDeleted();

        IEnumerable<TEntityBase> GetAll(IOrderedQueryable<TEntityBase> models, int pageIndex, int pageSize, out int count);

        IEnumerable<TEntityBase> GetAll(IQueryable<TEntityBase> models, int pageIndex, int pageSize, out int count);

        IEnumerable<TEntityBase> GetAll(int pageIndex, int pageSize, out int count);
        IQueryable<TEntityBase> GetAllWithDeleted(int pageIndex, int pageSize, out int count);

        IEnumerable<TEntityBase> SaveRange(IEnumerable<TEntityBase> list);

        IEnumerable<TEntityBase> AddRange(IEnumerable<TEntityBase> list);

        void UpdateRange(IEnumerable<TEntityBase> list);

        int SaveChanges();

    }
}
